<%--
  Created by IntelliJ IDEA.
  User: JAVA
  Date: 2018/5/17
  Time: 22:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
//输出
<c:out value="sessionScope.username" default="guest"/>
//条件处理
<c:if test="${sessionScope.username='admin' var='cond'}">
超级用户登录!
</c:if>
${cond}
//循环
<c:forEach var="i" begin ="1" end="10">
    ${i}<br/>
</c:forEach>
//JSTL链接到数据库
<sql:setDataSource var="datasource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/mysql"
user="test" password="test" scope="request"/>
//进行数据库的查询与操作
<sql:query var="userResults" dataSource="${datasource}">
    select * from userInfo when userpri=?<sql:param value="${pri}"/>
</sql:query>
</body>
</html>
